#import "JourneyThriveController.h"
        
#import "JourneyThriveModel.h"
#import "JourneyThriveCell.h"
#import "Masonry.h"

@interface JourneyThriveController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *nostalgiaTableView;
@property (nonatomic, strong) NSMutableArray *pirateDelightHammerDatas;

@end

@implementation JourneyThriveController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self prismPerceptiveInitview];
	[self swoopfetchData];
}


//: 懒加载数据模型数组
- (NSMutableArray *)pirateDelightHammerDatas {
	if (!_pirateDelightHammerDatas) {
		_pirateDelightHammerDatas = [NSMutableArray array];
	}
	return _pirateDelightHammerDatas;
}

//: 获取数据模型
- (void)swoopfetchData {
	
}

- (UITableView *)figHandleTableView {
    if (!_nostalgiaTableView) {
        _nostalgiaTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _nostalgiaTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
        _nostalgiaTableView.estimatedRowHeight = 0;
        _nostalgiaTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _nostalgiaTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
        _nostalgiaTableView.delegate = self;
        _nostalgiaTableView.dataSource = self;
        _nostalgiaTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
        _nostalgiaTableView.showsVerticalScrollIndicator = NO;
        _nostalgiaTableView.showsHorizontalScrollIndicator = NO;
        _nostalgiaTableView.backgroundColor = UIColor.clearColor;
    }
    return _nostalgiaTableView;
}

//: 初始化页面UI
- (void)prismPerceptiveInitview {

	[self.view addSubview:self.nostalgiaTableView];
	[self.nostalgiaTableView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.leading.trailing.equalTo(self.view);
		make.top.equalTo(self.view);
		make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
	}];
}


#pragma mark - UITableView DataSource 
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.pirateDelightHammerDatas.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    JourneyThriveCell *binary = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([JourneyThriveCell class])];
    if (binary == nil) {
        binary = [[JourneyThriveCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([JourneyThriveCell class])];
    }
    binary.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return binary;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	JourneyThriveModel *fable = self.pirateDelightHammerDatas[indexPath.row];
	return fable.imprintNostalgicCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
